div {
  display: inline-block;
  background-color: RGBa(240,160,0,0.5);
  height: 100px;
  width: 100px;
  margin: 50px 5px;
}
.d2{
  animation: translation 5s linear infinite;
}
@keyframes translation {
  0% {
    transform: perspective(100px) translate3d(0px, 0px, 0px);
  }
  25%{
    transform: perspective(100px) translate3d(0px, 0px, -100px)
  }
  50% {
    transform: perspective(100px) translate3d(0px, 0px, 0px);
  }
  75% {
    transform: perspective(100px) translate3d(0px, 0px, 50px);
  }
  100% {
    transform: perspective(100px) translate3d(0px, 0px, 0px);
  }
}
